package com.hnkywl.sts.dao.base;

import com.hnkywl.sts.entity.interfaces.Sort;
import net.ruixin.orm.hibernate.SimpleHibernateTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-5-20
 * Time: 下午8:48
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class SortDao extends SimpleHibernateTemplate<Sort, Long> {

    public List<Sort> findByMethodName(String methodname) {
        return find("from Sort where methodname = ?", methodname);
    }

    public void updateSort(String serialNumber, List<Sort> sortLists) {
        Sort sort = sortLists.get(0);
        sort.setSerialnumber(serialNumber);
        this.save(sort);
    }

    public void insertSort(String serialNumber, String methodName) {
        Sort sort = new Sort();
        sort.setSerialnumber(serialNumber);
        sort.setMethodname(methodName);
        this.save(sort);
    }


}
